﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;

namespace NCommet.Testing
{
    public class DemoInterceptor : IInterceptor
    {
        #region IInterceptor Members
        public void AfterTransactionBegin(ITransaction tx)
        {

        }

        public void AfterTransactionCompletion(ITransaction tx)
        {

        }

        public void BeforeTransactionCompletion(ITransaction tx)
        {

        }

        public void SetSession(ISession session)
        {

        }
        public int[] FindDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, NHibernate.Type.IType[] types)
        {
            //Console.WriteLine("FindDirty. id={0} entity={1}", id, entity);
            return null;
        }

        public object Instantiate(Type type, object id)
        {
            Console.WriteLine("Instantiate. id={0} type={1}", id, type);
            return null;
        }

        public object IsUnsaved(object entity)
        {
            Console.WriteLine("IsUnsaved. entity={0}", entity);
            return null;
        }

        public void OnDelete(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types)
        {
            Console.WriteLine("OnDelete. id={0} entity={1}", id, entity);
        }

        public bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, NHibernate.Type.IType[] types)
        {
            Console.WriteLine("OnFlushDirty. id={0} entity={1}", id, entity);
            return false;
        }

        public bool OnLoad(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types)
        {
            Console.WriteLine("OnLoad. id={0} entity={1}", id, entity);
            return false;
        }

        public bool OnSave(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types)
        {
            Console.WriteLine("OnSave. id={0} entity={1}", id, entity);
            return false;
        }

        public void PostFlush(System.Collections.ICollection entities)
        {
            Console.WriteLine("PostFlush. Count={0}", entities.Count);
        }

        public void PreFlush(System.Collections.ICollection entities)
        {
            Console.WriteLine("PreFlush. Count={0}", entities.Count);
        }

        #endregion
    }
}
